'''
Created on 11 Oct 2009

@author: joao
'''
import unittest

from problem001 import Problem001
from problem002 import Problem002
from problem003 import Problem003
from problem004 import Problem004
from problem005 import Problem005
from problem006 import Problem006
from problem007 import Problem007
from problem008 import Problem008
from problem009 import Problem009
from problem010 import Problem010
from problem011 import Problem011
from problem012 import Problem012
from problem013 import Problem013
from problem014 import Problem014
from problem015 import Problem015
from problem016 import Problem016
from problem017 import Problem017
from problem018 import Problem018
from problem019 import Problem019
from problem020 import Problem020
from problem021 import Problem021
from problem022 import Problem022
from problem023 import Problem023
from problem030 import Problem030

slowProblems = [5, 6, 12, 14, 20, 21, 23]

aBitSlowProblems = [4, 9, 10] 

solutionsDict = {
			1  : 233168,
			2  : 4613732,
			3  : 6857,
			4  : 906609,
			5  : 232792560,
			7  : 104729,
			8  : 40824,
			9  : 31875000,
			10 : 142913828922,
			11 : 70600674,
			12 : 76576500,
			13 : 5537376230,
			14 : 837799,
			15 : 137846528820,
			16 : 1366,
			17 : 21124,
			18 : 1074,
			19 : 171,
			20 : 648,
			21 : 31626,
			22 : 871198282,
			23 : 4179871,
			30: -1
			}

class ProblemTester(unittest.TestCase):
	
	def _testProblem(self, problem):
		
		problem.setEtcDir("../../etc/")
		
		if problem.problemNum() in slowProblems:
			print("Problem ", problem.problemNum(), " is still slow... skiping it...")
			return
		
		if problem.problemNum() in aBitSlowProblems:
			print("Problem ", problem.problemNum(), " is still a bit slow... skiping it...")
			return
		
		solution = problem.solveAndTime()
		print("Problem ", problem.problemNum(), ": ", str(solution))
		self.assertEquals(solution.solution(), solutionsDict[problem.problemNum()])

	def testProblem001(self):
		self._testProblem(Problem001())
		
	def testProblem002(self):
		self._testProblem(Problem002())

	def testProblem003(self):
		self._testProblem(Problem003())
		
	def testProblem004(self):
		self._testProblem(Problem004())
		
	def testProblem005(self):
		self._testProblem(Problem005())
				
	def testProblem006(self):
		self._testProblem(Problem006())

	def testProblem007(self):
		self._testProblem(Problem007())
		
	def testProblem008(self):
		self._testProblem(Problem008())
		
	def testProblem009(self):
		self._testProblem(Problem009())
		
	def testProblem010(self):
		self._testProblem(Problem010())
		
	def testProblem011(self):
		self._testProblem(Problem011())
		
	def testProblem012(self):
		self._testProblem(Problem012())
		
	def testProblem013(self):
		self._testProblem(Problem013())
		
	def testProblem014(self):
		self._testProblem(Problem014())

	def testProblem015(self):
		self._testProblem(Problem015())

	def testProblem016(self):
		self._testProblem(Problem016())
		
	def testProblem017(self):
		self._testProblem(Problem017())
		
	def testProblem018(self):
		self._testProblem(Problem018())
		
	def testProblem019(self):
		self._testProblem(Problem019())

	def testProblem020(self):
		self._testProblem(Problem020())

	def testProblem021(self):
		self._testProblem(Problem021())
		
	def testProblem022(self):
		self._testProblem(Problem022())
		
	def testProblem023(self):
		self._testProblem(Problem023())
		
	def testProblem030(self):
		self._testProblem(Problem030())


if __name__ == "__main__":
	#import sys;sys.argv = ['', 'Test.testName']
	unittest.main()
